package com.example.tabbar.utils

import android.content.Context
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.RecyclerView
import com.example.tabbar.R

class CustomLine(private var context: Context,private var recyclerView: RecyclerView) {

    private val dividerItemDecoration =
        DividerItemDecoration(context, DividerItemDecoration.VERTICAL)

    init {
        val drawable = ContextCompat.getDrawable(context, R.drawable.custom_divider)
        drawable?.let {
            dividerItemDecoration.setDrawable(it)
            recyclerView.addItemDecoration(dividerItemDecoration)
        }
    }

    // 可选：提供移除分割线的方法
    fun removeDivider() {
        recyclerView.removeItemDecoration(dividerItemDecoration)
    }
}

